//
//  BaseFuncTestVC.swift
//  GHSwiftProject
//
//  Created by Guanghui Liao on 4/10/18.
//  Copyright © 2018 liaoworking. All rights reserved.
//

import UIKit
import RxSwift
import RxCocoa
import Kingfisher
class BaseFuncTestVC: UIViewController {

    let disposeBag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = WHITE_COLOR
        testKingFisher()
    }
    
    func testKingFisher() {
        let testBtn = UIButton(frame: CGRect(x: 80, y: 150, width: 80, height: 30))
        testBtn.backgroundColor = UIColor.lightGray
        let url = URL(string: "http://h5.quzhaobei.com:6831/ZB-ESB/verCodeServlet.png?uuid=\(UUID)")
        //这里有问题 要先清理缓存再去加载图像码界面
        testBtn.rx.tap.subscribe(onNext: {
            let cache = KingfisherManager.shared.cache
            cache.clearMemoryCache()
            cache.clearDiskCache(completion: {
                testBtn.kf.setBackgroundImage(with: url, for: .normal)
            })
        }).disposed(by: disposeBag)
        testBtn.kf.setBackgroundImage(with: url, for: .normal)

        
        view.addSubview(testBtn)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
